package cn.huihui.miniprogram.stuman.controller;

import cn.huihui.miniprogram.stuman.dto.UserInfoDto;
import cn.huihui.miniprogram.stuman.service.AllService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户相关接口
 */
@Api("学生相关接口")
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    AllService allService;


    @ApiOperation("获取当前登录用户信息")
    @GetMapping("/info")
    public UserInfoDto currentUserInfo(){
        return allService.currentUserInfo();
    }

    @ApiOperation("修改当前用户信息")
    @GetMapping("/modify")
    public UserInfoDto modifyUserInfo(UserInfoDto userInfoDto){
        return allService.modifyUserInfo(userInfoDto);
    }

    @ApiOperation("根据学号获取学生信息")
    @GetMapping("/studentInfo")
    public UserInfoDto getStudentInfo(@RequestParam String id) {
        return allService.getStudentInfo(id);
    }


}
